<%@page import="com.sun.xml.internal.bind.v2.runtime.Location"%>
<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Insert title here</title>
</head>
<body>

<%
	
	String input=request.getParameter("Validate");   
	String code=(String)session.getAttribute("code");   
	
	String name = request.getParameter("username");
	String pwd = request.getParameter("password");
	
	//验证验证码是否正确，如正确，进行下一步：判断用户名和密码是否正确；如不正确，跳转回上一个页面重新输入
	if(input.equals(code)){   	     
	    
	    if(name.equals("admin") && pwd.equals("123456")){
	    	out.println("验证成功!");
	    	session.setAttribute("name","admin");
	    	session.setAttribute("pwd","123456");
	    	response.sendRedirect("LoginInfo.jsp?state=1");
	    }
	    else{
	    	response.sendRedirect("Login.jsp?state=0");
	    }  
	    
	}else{   
	    out.println("验证失败!");   
	    response.sendRedirect("Login.jsp?state=0");
	    
	}  

%>

</body>
</html>